package com.lzp.common.batch;

import com.lzp.entity.WechatBill;
import com.lzp.service.WechatBillService;
import org.springframework.batch.item.ItemWriter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Collection;
import java.util.List;

/**
 * @author lzp
 * @version 1.0.0
 * @date 2022/5/19 20:38:43
 * @apiNote
 */
@Component
public class BeanItemWriter implements ItemWriter<WechatBill> {

    @Autowired
    WechatBillService wechatBillService;
    @Override
    public void write(List<? extends WechatBill> items) {
        wechatBillService.saveBatch((Collection<WechatBill>) items);
    }
}
